jQuery.noConflict();
//for login.jsp
jQuery(document).ready(function(){
 
    // gender update processing--------------------------------------------------
    jQuery('#genderEdit').click(function(){
        jQuery('#genderDiv1').hide();
        jQuery('#genderDiv2').show();
        
    });
    
    jQuery('#genderCancel').click(function(){
        jQuery('#genderDiv1').show();
        jQuery('#genderDiv2').hide();
    });
    
    jQuery('#genderSave').click(function(){
        var x=document.getElementsByName('gender');
        var gender;
        for(var k=0;k<x.length;k++)
            if(x[k].checked){
                gender=x[k].value;
            }
        var url=jQuery('#genderDiv2').attr("url");
        jQuery.post(url, {
            gender:gender
        }, function(data){
            if(data=="true")
            {
                alert("update success");          
            }
            else{
                alert("update fail, try again latter");
                 
            }
            var reloadUrl=jQuery('#formEdit').attr("reloadurl");
            window.location.href=reloadUrl;
        })       
    });
    //------------------------------------------------------------------------------

    //Birth update processing-------------------------------------------------------

    jQuery('#birthEdit').click(function(){
        jQuery('#birthDiv1').hide();
        jQuery('#birthDiv2').show();
    });

    jQuery('#birthCancel').click(function(){
        jQuery('#birthDiv1').show();
        jQuery('#birthDiv2').hide();
    });

    jQuery('#birthSave').click(function(){
        var e = document.getElementById("birthMonth");
        var month = e.options[e.selectedIndex].value;

        e = document.getElementById("birthDay");
        var day = e.options[e.selectedIndex].value;

        e = document.getElementById("birthYear");
        var year = e.options[e.selectedIndex].value;
        
        var url=jQuery('#birthDiv2').attr("url");
        jQuery.post(url, {
            year:year,
            month:month,
            date:day
        }, function(data){
            if(data=="true")
            {
                alert("update success");
            }
            else
            {
                alert("update fail, try again latter");
            }
            var reloadUrl=jQuery('#formEdit').attr("reloadurl");
            window.location.href=reloadUrl;
        })
    });
    //------------------------------------------------------------------------------

    //password update Processing----------------------------------------------------

    jQuery('#passEdit').click(function(){
        jQuery('#passDiv1').hide();
        jQuery('#passDiv2').show();
    
    });

    jQuery('#passCancel').click(function(){
        jQuery('#passDiv1').show();
        jQuery('#passDiv2').hide();
    });
//------------------------------------------------------------------------------
    
});


